<?php

/**
 * This file is in charge of loading the minimum part of the engine necessary in order to be integrated in third party apps
 */

/******************************************************
 *					  READ CONFIG					  *
 ******************************************************/

require(__DIR__.DIRECTORY_SEPARATOR.'constants.php');
require(__DIR__.DS.'config.php');

/******************************************************
 *				    SET INCLUDE PATHS				  *
 ******************************************************/

$include_paths= array_filter(array(
	$_CONFIG->site_path.'engine'.DS.'lib'.DS,
	$_CONFIG->site_path.'engine'.DS.'clases'.DS
));

/******************************************************
 *				 INCLUDE CLASES AND LIBS			  * 
 ******************************************************/

foreach($include_paths as $path){
	foreach (glob($path.'*.php') as $filename){
	    require_once $filename;
	}	
}

/******************************************************
 *				 	   DATABASE						  * 
 ******************************************************/

$_DB= new BlgDB();
$_DB->connect();

/******************************************************
 *				 		SESSION						  * 
 ******************************************************/

blg_session_start();